#include<bits/stdc++.h>

using namespace std;
using i64 = long long;
using pii = pair<int, int>;


int read() {
	int x = 0, f = 0; char ch = getchar();
	while (!isdigit(ch)) f |= (ch == '-'), ch = getchar();
	while (isdigit(ch)) x = x * 10 + (ch - '0'), ch = getchar();
	return x;
}
int __stk[128], __len;
void put(i64 x) {
	if (x < 0) putchar('-'), x = -x;
	do { __stk[++__len] = x % 10; }while (x /= 10);
	while (__len) putchar(__stk[__len--] + '0');
}
const int N = 2e5 + 10, M = 1e6 + 10;
const i64 inf = 1e15;

int n, m, a[N];
i64 s[N], f[N][2], ans[M];

/* 
	f[i][0] = s[i] + max(f[j][1] + a[j] - s[j - 1])
	f[i][1] = -s[i] + min(f[j][0] - a[j] + s[j - 1])
	abs(solve(x) - solve(x + 1)) = 1 
*/

i64 solve(i64 x) {
	if (x >= s[n - 1]) return a[1] + x - (s[n - 1] - s[1]);
	if (ans[x] != -inf) return ans[x]; 
	f[n][0] = f[n][1] = 0;
	for (i64 i = n - 1, ma = x - s[n - 1], mi = -x + s[n - 1]; i > 1; --i) {
		f[i][0] = s[i] + ma, f[i][1] = mi - s[i];
		ma = max(ma, f[i][1] + a[i] - s[i - 1]);
		mi = min(mi, f[i][0] - a[i] + s[i - 1]);
	}
	return ans[x] = f[2][0] + a[1] - a[2];
}
int main() {
	freopen("pockets.in", "r", stdin);
	freopen("pockets.out", "w", stdout);
	n = read();
	for (int i = 1; i < n; ++i) a[i] = read(), s[i] = s[i - 1] + a[i];
	for (int i = 0; i < s[n - 1]; ++i) ans[i] = -inf;
	m = read();
	while (m--) put(solve(read())), putchar('\n');
	return 0;
}
/*
5 
1 3 4 2
4 
3 
5 
10
15

*/
